home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 12 - 1996 / 12.09 Sep 96 / C++ DebugStr / doututils.cp < prev    next >
Encoding:
Text File  |  1996-06-18  |  1.7 KB  |  149 lines  |  [TEXT/R*ch]

  1. // (c) copyright 1995,1996, Jon Kalb, Liberty Software
  2. // Kalb@LibertySoft.com
  3. // You may freely incorporate this code into any machine-
  4. // readable project. You may modify this code, but you may
  5. // not remove this statement. 
  6.  
  7. #include "doututils.h"
  8.  
  9. ostream &showflags(ostream &stream)
  10. {
  11.     long f;
  12.  
  13.     f = stream.flags();    // get flag settings
  14.  
  15.     if (ios::skipws & f)
  16.     {
  17.         stream << "SKIPWS     ";
  18.     }
  19.     else
  20.     {
  21.         stream << "skipws     ";
  22.         
  23.     }
  24.  
  25.     if (ios::left & f)
  26.     {
  27.         stream << "LEFT       ";
  28.     }
  29.     else
  30.     {
  31.         stream << "left       ";
  32.     }
  33.  
  34.     if (ios::right & f)
  35.     {
  36.         stream << "RIGHT      ";
  37.     }
  38.     else
  39.     {
  40.         stream << "right      ";
  41.     }
  42.  
  43.     if (ios::internal & f)
  44.     {
  45.         stream << "INTERNAL   ";
  46.     }
  47.     else
  48.     {
  49.         stream << "internal   ";
  50.     }
  51.     stream << endl;
  52.  
  53.     if (ios::dec & f)
  54.     {
  55.         stream << "DEC        ";
  56.     }
  57.     else
  58.     {
  59.         stream << "dec        ";
  60.     }
  61.  
  62.     if (ios::oct & f)
  63.     {
  64.         stream << "OCT        ";
  65.     }
  66.     else
  67.     {
  68.         stream << "oct        ";
  69.     }
  70.  
  71.     if (ios::hex & f)
  72.     {
  73.         stream << "HEX        ";
  74.     }
  75.     else
  76.     {
  77.         stream << "hex        ";
  78.     }
  79.  
  80.     if (ios::showbase & f)
  81.     {
  82.         stream << "SHOWBASE   ";
  83.     }
  84.     else
  85.     {
  86.         stream << "showbase   ";
  87.     }
  88.     stream << endl;
  89.  
  90.     if (ios::showpoint & f)
  91.     {
  92.         stream << "SHOWPOINT  ";
  93.     }
  94.     else
  95.     {
  96.         stream << "showpoint  ";
  97.     }
  98.  
  99.     if (ios::uppercase & f)
  100.     {
  101.         stream << "UPPERCASE  ";
  102.     }
  103.     else
  104.     {
  105.         stream << "uppercase  ";
  106.     }
  107.  
  108.     if (ios::showpos & f)
  109.     {
  110.         stream << "SHOWPOS    ";
  111.     }
  112.     else
  113.     {
  114.         stream << "showpos    ";
  115.     }
  116.  
  117.     if (ios::scientific & f)
  118.     {
  119.         stream << "SCIENTIFIC ";
  120.     }
  121.     else
  122.     {
  123.         stream << "scientific ";
  124.     }
  125.     stream << endl;
  126.  
  127.     if (ios::fixed & f)
  128.     {
  129.         stream << "FIXED      ";
  130.     }
  131.     else
  132.     {
  133.         stream << "fixed      ";
  134.     }
  135.  
  136.     if (ios::unitbuf & f)
  137.     {
  138.         stream << "UNITBUF    ";
  139.     }
  140.     else
  141.     {
  142.         stream << "unitbuf    ";
  143.     }
  144.     stream << endl;
  145.  
  146.     return stream;
  147. }
  148.  
  149.